# models.py
# The models used by ap-pic
from google.appengine.ext import db

#The raw picture. Full size
class RawPicture(db.Model):
  """Raw Picture, as PNG File"""
  image = db.BlobProperty()
  date = db.DateTimeProperty(auto_now_add=True)


# the Picture
class Picture(db.Model):
  """Picture, with title"""
  author = db.UserProperty()
  title = db.StringProperty(multiline=False)
  image = db.BlobProperty()
  thumbnail = db.BlobProperty()
  date = db.DateTimeProperty(auto_now_add=True)
  rawImage = db.ReferenceProperty(RawPicture)


class Comment(db.Model):
  """Comment on a Picture"""
  author = db.UserProperty()
  content = db.StringProperty(multiline=True)
  date = db.DateTimeProperty(auto_now_add=True)
  postedOn = db.ReferenceProperty(Picture)
  
class UserSettings(db.Model):
  """Storing the user settings. Someday this might store twitter passwords"""
  owner = db.UserProperty()
  email = db.StringProperty() #Horrible hack. manually setting email. Will cause problems when email ID changes.
  enableAPI = db.BooleanProperty(default=False, verbose_name="Allow posting using API?")
  apiAuthString = db.StringProperty(verbose_name="Password for your Cellphone Upload App") #how do I keep it unique?
  notifyBlogger = db.BooleanProperty(default=False, verbose_name="Post Update on Blogger?")
  bloggerEmail = db.StringProperty(verbose_name="Blogger Quickpost Email")
  notifyFacebook = db.BooleanProperty(default=False, verbose_name="DOES-NOT-WORK - Post Update on Facebook?")
  facebookEmail = db.StringProperty(verbose_name="DOES-NOT-WORK - Facebook Quickpost Email")
  notifyTwitter = db.BooleanProperty(default=False, verbose_name="Post Update on Twitter?")
  twitterUsername = db.StringProperty(verbose_name="Twitter Username")
  twitterPassword = db.StringProperty(verbose_name="Twitter Password")
  notifyOnComments = db.BooleanProperty(default=False, verbose_name="Email me on New Comments on my Pics")

